package dletic.File;

import java.io.File;

/**
 File类的判断功能
 *public boolean isDirectory()：判断是否是文件目录
 *public boolean isFile() ：判断是否是文件
 *public boolean exists() ：判断是否存在
 public boolean canRead() ：判断是否可读
 public boolean canWrite() ：判断是否可写
 public boolean isHidden() ：判断是否隐藏
 */
public class Demo04 {

	public static void main(String[] args) {

		/**
		 * public boolean isDirectory()：判断是否是文件目录
		 */

		File file = new File("D:\\中软学习\\CodeSpace\\day31\\src\\demo");
		
		boolean directory = file.isDirectory();
		System.out.println(directory);  //true
		
		/**
		 * public boolean isFile() ：判断是否是文件
		 */
		boolean file2 = file.isFile();
		System.out.println(file2); //false
		
		/**
		 * public boolean exists() ：判断是否存在
		 */
		boolean exists = file.exists();
		System.out.println(exists);  //true
		
		/**
		 * public boolean canRead() ：判断是否可读
		 */
		
		boolean canRead = file.canRead();
		System.out.println(canRead); //true
		
		/**
		 * public boolean canWrite() ：判断是否可写
		 */
		
		boolean canWrite = file.canWrite();
		System.out.println(canWrite); //true
		
		/**
		 * public boolean isHidden() ：判断是否隐藏
		 */
		
		boolean hidden = file.isHidden();
		System.out.println(hidden); //false

	}

}
